package com.sunwayworld.basemodule.common.eptstorage.db.resource;

import com.sunwayworld.basemodule.common.eptstorage.db.bean.LimsDbconnBean;
import com.sunwayworld.basemodule.common.eptstorage.db.service.LimsDbconnService;
import com.sunwayworld.framework.data.page.Page;
import com.sunwayworld.framework.log.annotation.Log;
import com.sunwayworld.framework.log.annotation.LogType;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;
import com.sunwayworld.framework.support.base.resource.GenericResource;
import com.sunwayworld.framework.support.choosable.resource.GenericChoosableResource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;
import java.util.Map;

@RequestMapping("/secure/basemodule/common/eptstorage/dbconns")
public interface LimsDbconnResource extends GenericResource<LimsDbconnService, LimsDbconnBean, Long>, GenericChoosableResource<LimsDbconnService, LimsDbconnBean, Long> {
    @Log(
        value = "界面查询",
        type = LogType.SELECT
    )
    @RequestMapping(
            value = {"/ui/queries"},
            method = {RequestMethod.POST}
    )
    Page<LimsDbconnBean> selectUiPagination(RestJsonWrapperBean wrapper);

    @Log(
            value = "测试连接",
            type = LogType.SELECT
    )
    @RequestMapping(
            value = {"/connect"},
            method = {RequestMethod.POST}
    )
    String connect(RestJsonWrapperBean wrapper);

    @Log(
            value = "测试SQL",
            type = LogType.SELECT
    )
    @RequestMapping(
            value = {"/testSQL"},
            method = {RequestMethod.POST}
    )
    List<Map<String,Object>> testSQL(RestJsonWrapperBean wrapper);
}
